<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改职称申报')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-compete-score" th:object="${recordCompete}">
            <input name="competeId" th:field="*{competeId}" type="hidden">
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">现资格等级：</label>
                        <div class="col-sm-8">
                            <select id="obtainLevel" class="form-control m-b" disabled th:with="type=${@dict.getType('basic_post_level')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{obtainLevel}"></option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">现资格时间：</label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control time-input" disabled id="obtainTime" th:field="*{obtainTime}"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">现聘任等级：</label>
                        <div class="col-sm-8">
                            <select id="postLevel" class="form-control m-b" disabled th:with="type=${@dict.getType('basic_post_level')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{postLevel}"></option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">现聘任时间：</label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control time-input" disabled id="engageTime" th:field="*{engageTime}" />
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">现职务资格：</label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control time-input" readonly name="postName" th:field="*{postName}" />
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">竞聘等级：</label>
                        <div class="col-sm-8">
                            <select id="competeLevel" class="form-control m-b" disabled th:with="type=${@dict.getType('basic_post_level')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{competeLevel}"></option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">是否担任过带教老师或教学秘书及时间：</label>
                        <div class="col-sm-8">
                            <select name="isTeacher" class="form-control m-b" disabled th:with="type=${@dict.getType('sys_yes_no')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isTeacher}"></option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">是否参加过支农、第一村医等活动及时间：</label>
                        <div class="col-sm-8">
                            <select name="isFarmer" class="form-control m-b" disabled th:with="type=${@dict.getType('sys_yes_no')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isFarmer}"></option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">继续教育及继续医学教育学分是否达到合格标准：</label>
                        <div class="col-sm-8">
                            <select name="isStandard" class="form-control m-b" disabled th:with="type=${@dict.getType('sys_yes_no')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isStandard}"></option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">聘任现职务以来是否发生过医疗事故或投诉：</label>
                        <div class="col-sm-8">
                            <select name="isFailure" class="form-control m-b" disabled th:with="type=${@dict.getType('sys_yes_no')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isFailure}"></option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">学术兼职：</label>
                        <div class="col-sm-8">
                            <input name="plurality" class="form-control" disabled th:field="*{plurality}" type="text">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">备注：</label>
                        <div class="col-sm-8">
                            <input name="remark" class="form-control" disabled th:field="*{remark}" type="text">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">科教分值：</label>
                        <div class="col-sm-8">
                            <input name="score10" id="score10" class="form-control" th:onchange="changeScore13()" th:field="*{score10}" type="number" th:readonly="${userType == 'science'} ? false : true">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">带教老师：</label>
                        <div class="col-sm-8">
                            <input name="score12" id="score12" class="form-control" th:onchange="changeScore13()" th:field="*{score12}" type="number" th:readonly="${userType == 'science'} ? false : true">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">继续医学教育是否合格：</label>
                        <div class="col-sm-8">
                            <select name="score1" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}" th:readonly="${userType == 'science'} ? false : true">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{score1}"></option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">学历得分：</label>
                        <div class="col-sm-8">
                            <input name="score2" id="score2" class="form-control" th:field="*{score2}" th:onchange="changeScore4()" type="number" th:readonly="${userType == 'human'} ? false : true">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">资历得分：</label>
                        <div class="col-sm-8">
                            <input name="score3" id="score3" class="form-control" th:field="*{score3}" th:onchange="changeScore4()" type="number" th:readonly="${userType == 'human'} ? false : true">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">硬件分：</label>
                        <div class="col-sm-8">
                            <input name="score4" id="score4" class="form-control" th:field="*{score4}" type="number" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">考核情况：</label>
                        <div class="col-sm-8">
                            <input name="score5" class="form-control" th:field="*{score5}" type="text" th:readonly="${userType == 'human'} ? false : true">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">考核得分：</label>
                        <div class="col-sm-8">
                            <input name="score6" id="score6" class="form-control" th:onchange="changeScore13()" th:field="*{score6}" type="number" th:readonly="${userType == 'human'} ? false : true">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">兼职：</label>
                        <div class="col-sm-8">
                            <input name="score7" id="score7" class="form-control" th:onchange="changeScore13()" th:field="*{score7}" type="number" th:readonly="${userType == 'human'} ? false : true">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">荣誉：</label>
                        <div class="col-sm-8">
                            <input name="score8" class="form-control" th:field="*{score8}" type="text" th:readonly="${userType == 'human'} ? false : true">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">荣誉得分：</label>
                        <div class="col-sm-8">
                            <input name="score9" id="score9" class="form-control" th:onchange="changeScore13()" th:field="*{score9}" type="number" th:readonly="${userType == 'human'} ? false : true">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">软件总分：</label>
                        <div class="col-sm-8">
                            <input name="score13" id="score13" class="form-control" th:field="*{score13}" type="number" readonly>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">村医：</label>
                        <div class="col-sm-8">
                            <input name="score11" id="score11" class="form-control" th:onchange="changeScore13()" th:field="*{score11}" type="number" th:readonly="${userType == 'medical'} ? false : true">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">医务科考核得分：</label>
                        <div class="col-sm-8">
                            <input name="score16" id="score16" class="form-control" th:onchange="changeScore13()" th:field="*{score16}" type="number" th:readonly="${userType == 'medical'} ? false : true">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">医务科扣分：</label>
                        <div class="col-sm-8">
                            <input name="score14" class="form-control" th:field="*{score14}" type="number" th:readonly="${userType == 'medical'} ? false : true">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">纪检监察室扣分：</label>
                        <div class="col-sm-8">
                            <input name="score15" class="form-control" th:field="*{score15}" type="number" th:readonly="${userType == 'discipline'} ? false : true">
                        </div>
                    </div>
                </div>
            </div>
            <h4 class="form-header h4">论文或著作（最多三项）</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="col-sm-12 select-table table-striped">
                        <table id="bootstrap-table1"></table>
                    </div>
                </div>
            </div>
            <h4 class="form-header h4">科研或专利（最多三项）</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="col-sm-12 select-table table-striped">
                        <table id="bootstrap-table2"></table>
                    </div>
                </div>
            </div>
            <h4 class="form-header h4">荣誉（最多三项）</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="col-sm-12 select-table table-striped">
                        <table id="bootstrap-table3"></table>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "record/compete";
        $("#form-compete-score").validate({
            focusCleanup: true
        });

        $(function() {
            initTable1();
            initTable2();
            initTable3();
        });

        function initTable1() {
            var options = {
                data: [[${recordCompete.info1List}]],
                id: "bootstrap-table1",
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [
                    {
                        field: 'index',
                        align: 'center',
                        title: "序号",
                        formatter: function (value, row, index) {
                            var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                            return columnIndex + $.table.serialNumber(index);
                        }
                    },
                    {
                        field: 'title',
                        align: 'center',
                        title: '名称'
                    },
                    {
                        field: 'position',
                        align: 'center',
                        title: '位次'
                    }]
            };
            $.table.init(options);
        }

        function initTable2() {
            var options = {
                data: [[${recordCompete.info2List}]],
                id: "bootstrap-table2",
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [
                    {
                        field: 'index',
                        align: 'center',
                        title: "序号",
                        formatter: function (value, row, index) {
                            var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                            return columnIndex + $.table.serialNumber(index);
                        }
                    },
                    {
                        field: 'title',
                        align: 'center',
                        title: '名称'
                    },
                    {
                        field: 'position',
                        align: 'center',
                        title: '位次'
                    }]
            };
            $.table.init(options);
        }

        function initTable3() {
            var options = {
                data: [[${recordCompete.info3List}]],
                id: "bootstrap-table3",
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'index',
                        align: 'center',
                        title: "序号",
                        formatter: function (value, row, index) {
                            var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                            return columnIndex + $.table.serialNumber(index);
                        }
                    },
                    {
                        field: 'title',
                        align: 'center',
                        title: '名称'
                    }]
            };
            $.table.init(options);
        }

        function changeScore4() {
            var score2 = $("#score2").val();
            var score3 = $("#score3").val();
            if(score2 == '') {
                score2 = 0;
            }
            if(score3 == '') {
                score3 = 0;
            }
            var score4 = parseFloat(score2) + parseFloat(score3);
            $("#score4").val(score4);
        }

        function changeScore13() {
            var score6 = $("#score6").val();
            if(score6 == '') {
                score6 = 0;
            }
            var score7 = $("#score7").val();
            if(score7 == '') {
                score7 = 0;
            }
            var score9 = $("#score9").val();
            if(score9 == '') {
                score9 = 0;
            }
            var score10 = $("#score10").val();
            if(score10 == '') {
                score10 = 0;
            }
            var score11 = $("#score11").val();
            if(score11 == '') {
                score11 = 0;
            }
            var score12 = $("#score12").val();
            if(score12 == '') {
                score12 = 0;
            }
            var score16 = $("#score16").val();
            if(score16 == '') {
                score16 = 0;
            }
            var score13 = parseFloat(score6) + parseFloat(score7) + parseFloat(score9) + parseFloat(score10) + parseFloat(score11) + parseFloat(score12) + parseFloat(score16);
            $("#score13").val(score13);
        }

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/score/save", $('#form-compete-score').serialize());
            }
        }
    </script>
</body>
</html>